package net.qhzw.vip.qiyu.task;

import lombok.extern.slf4j.Slf4j;
import net.qhzw.vip.qiyu.service.ScheduledTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
@Slf4j
public class ScheduledTask {

    @Autowired
    private ScheduledTaskService scheduledTaskService;

    /***
     * 租车成功后每次扣费
     */
    @Scheduled(cron = "0 30 1 * * ?")
//    @Scheduled(cron = "0 0/1 * * * ?")
    public void execution() {
        log.info("执行每日扣费定时任务, 时间: {}", LocalDateTime.now());
        scheduledTaskService.execution();
    }
}
